<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%
request.setCharacterEncoding("utf-8");
%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

    <jsp:include page="../../common/meta/meta.jsp"></jsp:include>
    
    <!-- 引入页面css -->
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/pcsofangche/my/login/login.css" />
    <!-- 引入页面js -->
    <script src="${pageContext.request.contextPath}/static/pcsofangche/my/login/login.js" type="text/javascript" charset="utf-8"></script>
<div class="login_head">
	<div class="login_head_topone"></div>
	<div class="login_head_toptwo"></div>
	<div class="login_head_content"><jsp:include page="../../common/allhead/allhead.jsp"></jsp:include></div>
</div>
<div class="login_back" style="background: url(${pageContext.request.contextPath}/static/pcsofangche/my/login/img/login_all_big.png);background-position: center center;width: 100%;"></div>
<div class="container">
    <div class="row back">
        <div class="col-lg-12 col-md-12">
            <div>
                <div class="container">
                    <div class="row">
                        <div class="col-lg-12 col-md-12">
                            <div class="userpsw">
                                <div class="login">用户登陆</div>
                                <div class="row tab">
                                    <div class="col-lg-6 col-lg-6 phonelogin phoneloginchoose" onclick="changeplogin()">手机快捷登录</div>
                                    <div class="col-lg-6 col-lg-6 pswdlogin" onclick="changeuplogin()">账号密码登陆</div>
                                </div>
                                <div class="hengxian"></div>
                                <!--手机快捷登陆-->
                                <div class="plogin" id="plogin">
                                    <div class="phone">
                                        <input type="text" placeholder="请输入中国大陆手机号" style="font-size:14px;color:grey;width: 330px;height: 40px;line-height: 40px" id="phone" class="login_plogin_input"/>
                                    </div>

                                    <div class="vcode">
                                        <input type="text" placeholder="请输入右边图片验证码" style="color:grey;width: 220px;height: 40px;line-height: 40px;" id="vcode" class="login_vcode_input"/>
                                        <div class="vcodeimg">
                                            <img src="${pageContext.request.contextPath}/meb/codeimg" id="vcodeimg" style="height: 40px;width:110px" onclick="changevcode()">
                                        </div>
                                    </div>
                                    <div class="waring" id="vcodewaring">验证码错误，请重新输入</div>
                                    <div class="pcode">
                                        <input type="text" placeholder="手机验证码" id="pcode" style="color:grey;width: 220px;height: 40px;line-height: 40px" class="login_pcode_input"/>
                                        <input type="button" class="sendpcode" onclick="sendcode()" value="发送验证码" />
                                    </div>
                                </div>
                                <!--账号密码登陆-->
                                <div class="uplogin" id="uplogin">
                                    <div class="phone">
                                        <input type="text" placeholder="请输入中国大陆手机号" style="color:grey;width: 330px;height: 40px;line-height: 40px" id="upphone" class="login_plogin_input"/>
                                    </div>
                                    <div class="psd" id="password">
                                        <input type="password"  style="color:grey;width: 330px;height: 40px;line-height: 40px" placeholder="请输入密码" id="pswd" class="login_pcode_input">
                                    </div>
                                    <div class="vcode">
                                        <input type="text" placeholder="请输入右边图片验证码" style="color:grey;width: 220px;height: 40px;line-height: 40px" id="upvcode" class="login_vcode_input"/>
                                        <div class="vcodeimg">
                                            <img src="${pageContext.request.contextPath}/meb/codeimg" id="upvcodeimg" style="height: 40px;width:110px;line-height: 40px;" onclick="changeupvcode()">
                                        </div>
                                    </div>
                                    <div class="waring" id="upvcodewaring">验证码错误，请重新输入</div>
                                </div>

                                <div class="password">
                                    <!-- <input type="checkbox" id="psdflag" onclick="checkboxOnclick(this)">自动登录 -->
                                </div>
                                <div class="submit">
                                    登&nbsp;&nbsp;&nbsp;&nbsp;录
                                </div>
                                <div class="toother">
                                    <div class="torgst">
                                        <a onclick="torgst()">注册</a>
                                    </div>
                                    <div class="toforget">
                                        <a onclick="toforget()">忘记密码</a>
                                    </div>
                                </div>
                                
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="login_foot"><jsp:include page="../../common/allfoot/allfoot.jsp"></jsp:include></div>
<div class="login_slide"><jsp:include page="../../common/allside/allside.jsp"></jsp:include></div>
<script>

$(document).ready(function(){
});

    var logintype='plogin'
    //下面横线要加样式
    function changeplogin() {
        logintype='plogin'
        $("#plogin").css("display","block");
        $("#uplogin").css("display","none");
        $("div.phonelogin").addClass("phoneloginchoose");
        $("div.tab>div").not("div.phonelogin").removeClass("phoneloginchoose");
    }
    function changeuplogin() {
        logintype='uplogin'
        $("#plogin").css("display","none");
        $("#uplogin").css("display","block");
        $("div.pswdlogin").addClass("phoneloginchoose");
        $("div.tab>div").not("div.pswdlogin").removeClass("phoneloginchoose");
    }

    //点击切换验证码
    function changevcode(){
            console.log("123")
            var random=Math.random()
            console.log(random);
            $("#vcodeimg").attr('src',basePath+'/meb/codeimg?'+random);

    }

function changeupvcode(){
	
    var random=Math.random()
    console.log(random);
    $("#upvcodeimg").attr('src',basePath+'/meb/codeimg?'+random);

}
//点击发送手机验证码
function sendcode() {
	var vcode=$("#vcode").val();
    console.log(vcode)
    $.ajax({
        url:basePath+'/meb/checkcode',
        data:{
            code:vcode
        },
        type:'post',
        dataType:'json',
        success:function(data){
            vcheck=data.code;
            if(data.code=="2"){
                console.log("xxxx")
                $("#vcodewaring").css('display','block');
                changevcode();
                phonetestcode=2;
                layer.msg("验证码错误，请重新输入");
            }
            if(data.code=="1"){
                $("#vcodewaring").css('display','none');
                phonetestcode=1;
                CheckPhoneCode();
               
            }
        },
        error:function(data){

        },
        complete:function (data) {

        }
    })
}

//跳转注册
function torgst(){
    /* window.location.href=basePath+"/meb/userregister"; */
	window.location.href=basePath+"/myregister";
}

//跳转忘记密码
function toforget(){
    window.location.href=basePath+"/myforget";
}
</script>

